﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WPFDBBrowser;
using System.Windows;
using Microsoft.Practices.Unity;
using WPFDBBrowser.Settings;
using WPFDBBrowser.Framework;
using WPFDBBrowser.MessageBus;
using WPFDBBrowser.Helpers;

namespace WPFDBBrower
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            Application mainEntry = new Application();
            ComponentsSettings components = new ComponentsSettings();
            //ComponentInfo info = new ComponentInfo("OracleFactory.dll");
            //info.Interfaces.Add(new ImplementedInterface(BorwserInterfaces.IDBFactory, "WPFDBBrowser.OracleFactory.OracleDBFactory"));
            //components.ComponentInfos.Add(info);
            //components.SaveSettings();
            components.LoadSettings();
            ComponentsLoader.Load(components);
            //IUnityContainer container = UnityResolver.GetContainer();
            IUnityContainer container = UnityContainerFactory.GetInstance();
            // Register instances in Unity container
            container.RegisterInstance<IMessageBus>(MessageBusFactory.GetInstance());
            container.RegisterInstance<IServiceProvider>(new ServiceProvider());
            mainEntry.Run(container.Resolve<MainWindow>());
        }
    }
}